package com.experienceBaby.Cashbook.fragment;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import com.bumptech.glide.Glide;
import com.experienceBaby.Cashbook.databinding.FragmentUserinfoBinding;

import org.jetbrains.annotations.NotNull;

public class UserInfoFragment extends Fragment {
    FragmentUserinfoBinding binding;
    UserFragment userFragment;

    public UserInfoFragment(UserFragment userFragment) {
        this.userFragment = userFragment;
    }

    @Nullable
    @org.jetbrains.annotations.Nullable
    @Override
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        binding = FragmentUserinfoBinding.inflate(inflater, container, false);
        initData();
        initView();
        return binding.getRoot();
    }

    private void initView() {
        binding.logout.setOnClickListener(view -> {
            getActivity().getSharedPreferences("User", Context.MODE_PRIVATE).edit().putBoolean("isLogin", false).apply();
            userFragment.logout();
        });
//        Glide
//                .with(context)
//                .load(getItem(j).getImage())
//                .into(viewHolderMap.get(j).iv);
    }

    private void initData() {

    }
}
